<template>
  <div style="height: 100%; position: relative">
    <el-drawer
      title="查看兑换信息"
      :visible.sync="show_dialog"
      direction="rtl"
      size="80%"
      custom-class="demo-drawer"
      ref="drawer"
    >
      <div class="demo-drawer__content" ref="content">
        <div class="infoTitle">兑换信息</div>
        <div class="booking-detail">
          <!-- <p class="fSize12">预约状态</p> -->
          <ul>
            <li>
              <span class="label">兑换单号: </span>
              <span class="content">{{ od.point_ordersn }}</span>
            </li>
            <li>
              <span class="label">状态: </span>
              {{
                od.point_orderstatetext && od.point_orderstatetext.order_state
              }}
              <span
                v-if="
                  od.point_orderstatetext &&
                    od.point_orderstatetext.change_state
                "
                >{{ `,${od.point_orderstatetext.change_state}` }}</span
              >
            </li>
            <li>
              <span class="label">京东单号: </span>
              <span class="content">{{ od.jd_order_num }}</span>
            </li>
            <li>
              <span class="label">兑换元宝: </span>
              <span class="content">{{ od.point_allpoint }}</span>
            </li>
            <li>
              <span class="label">运费: </span>
              <span class="content">{{ od.point_shippingfee }}</span>
            </li>
            <li>
              <span class="label">兑换时间: </span>
              <span class="content">{{
                (od.point_addtime * 1000) | dateFormatter("YYYY-MM-DD")
              }}</span>
            </li>
            <li>
              <span class="label">订单来源: </span>
              <span class="content">{{ od.point_origin }}</span>
            </li>
          </ul>
        </div>
        <div class="infoTitle">兑换详情</div>
        <div class="booking-detail">
          <p class="fSize12">会员信息</p>
          <ul>
            <li>
              <span class="label">会员名称: </span>
              <span class="content">{{ od.point_buyername }}</span>
            </li>
            <li>
              <span class="label">会员Email: </span>
              <span class="content">{{ od.point_buyeremail }}</span>
            </li>
            <li>
              <span class="label">手机: </span>
              <span class="content">{{ od.member_mobile }}</span>
            </li>
            <li>
              <span class="label">留言: </span>
              <span class="content">{{ od.point_ordermessage }}</span>
            </li>
          </ul>
          <div class="row_line"></div>
          <ul>
            <li>
              <span class="label">支付方式: </span>
              <span class="content">{{ od.point_paymentname }}</span>
            </li>
            <li>
              <span class="label">支付时间: </span>
              <span class="content">{{ od.point_paymenttime }}</span>
            </li>
            <li>
              <span class="label">支付留言: </span>
              <span class="content">{{ od.point_paymessage }}</span>
            </li>
          </ul>
          <div class="row_line"></div>
          <p class="fSize12">收货人及发货信息</p>
          <ul>
            <li>
              <span class="label">收货人: </span>
              <span class="content">{{ od.point_truename }}</span>
            </li>
            <li>
              <span class="label">所在地区: </span>
              <span class="content">{{ od.point_areainfo }}</span>
            </li>
            <li>
              <span class="label">邮政编码: </span>
              <span class="content">{{ od.point_zipcode }}</span>
            </li>
            <li>
              <span class="label">电话号码: </span>
              <span class="content">{{ od.point_telphone }}</span>
            </li>
            <li>
              <span class="label">手机号码: </span>
              <span class="content">{{ od.point_mobphone }}</span>
            </li>
            <li>
              <span class="label">详细地址: </span>
              <span class="content">{{ od.point_address }}</span>
            </li>
            <li>
              <span class="label">物流单号: </span>
              <span class="content">{{ od.point_shippingcode }}</span>
            </li>
            <br />
            <li>
              <span class="label">发货描述: </span>
              <span class="content">{{ od.point_shippingdesc }}</span>
            </li>
          </ul>
          <div class="row_line"></div>
          <p class="fSize12">礼品信息</p>
          <el-table :data="od.prod_list" style="width: 100%">
            <el-table-column label="商品图片" min-width="320" #default="{row}">
              <div class="goodsInfo">
                <img :src="row.point_goodsimage" alt style="width:50px;" />
                <span>{{ row.point_goodsname }}</span>
              </div>
            </el-table-column>
            <el-table-column
              prop="point_goodsid"
              align="center"
              label="商品ID"
              min-width="80"
            ></el-table-column>
            <el-table-column
              prop="pgoods_serial"
              align="center"
              label="商品编码"
              min-width="120"
            ></el-table-column>
            <el-table-column
              align="center"
              label="供应商"
              min-width="120">
              {{od.store_name}}
            </el-table-column>
            <el-table-column
              prop="point_goodspoints"
              align="center"
              label="兑换元宝"
              min-width="100"
            ></el-table-column>
            <el-table-column
              prop="point_goodsnum"
              align="center"
              label="兑换数量"
              min-width="100"
            ></el-table-column>
            <el-table-column
              prop="point_goodspaynum"
              align="center"
              label="兑换金额"
              min-width="100"
            ></el-table-column>
          </el-table>
        </div>
      </div>
      <div class="demo-drawer__footer">
        <el-button @click="cancelForm">取 消</el-button>
        <el-button type="primary" @click="handleClose" :loading="loading">{{
          loading ? "提交中 ..." : "确 定"
        }}</el-button>
      </div>
    </el-drawer>
  </div>
</template>
<script>
import { dateFormatter } from "@/common/js/util";
export default {
  props: ["dialog"],
  data() {
    return {
      loading: false,
      show_dialog: false, //弹窗显示
      od: "",
    };
  },
  methods: {
    show_dialog_fn(row) {
      (this.show_dialog = true), this.getOrderDetail(row.point_orderid);
    },
    cancelForm() {
      this.loading = false;
      this.show_dialog = false;
      clearTimeout(this.timer);
    },
    handleClose(done) {
      this.$refs.drawer.closeDrawer();
    },
    getOrderDetail(id) {
      this.$http
        .get(`/admin/pointprod/index.php?act=pointOrder&op=get&order_id=${id}`)
        .then((res) => {
          this.od = res.data;
        })
        .catch((err) => {
          this._message("error", err);
        });
    },
  },
};
</script>

<style lang="scss" scoped>
.el-form {
  // width: 560px;
  padding-left: 10px;
}

.el-select /deep/.el-input {
  width: 360px;
}
.plantTable /deep/.el-input {
  width: auto;
}
form /deep/.el-input {
  width: 360px;
}

.demo-drawer__content {
  position: absolute;
  top: 0;
  bottom: 60px;
  width: 100%;
  overflow-y: auto;
}

/deep/.el-drawer__body {
  position: absolute;
  top: 77px;
  bottom: 0;
  width: 100%;
  overflow: auto;
  padding-bottom: 60px;
}

.demo-drawer__footer {
  position: absolute;
  bottom: 10px;
  left: 20px;
}

.avatar-uploader /deep/.el-upload {
  border: 1px dashed #d9d9d9;
  border-radius: 6px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.avatar-uploader /deep/.el-upload:hover {
  border-color: #409eff;
}

.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 178px;
  height: 178px;
  line-height: 178px;
  text-align: center;
}

.avatar {
  width: 178px;
  height: 178px;
  display: block;
}
.infoTitle {
  width: calc(100% - 40px);
  margin: 0 auto;
  font-size: 14px;
  font-weight: 600;
  color: #5e728a;
  line-height: 40px;
  padding-left: 10px;
  background-color: #f3f5f8;
}
.booking-detail {
  padding: 0px 20px;
  .fSize12 {
    font-size: 12px;
    font-weight: 600;
    padding: 10px;
    border-bottom: 1px dashed #d7d8dc;
  }
  ul {
    display: flex;
    font-size: 14px;
    padding: 10px 0 10px 50px;
    flex-wrap: wrap;
    li {
      width: 50%;
      padding: 2px 0;
      font-size: 12px;
      .label {
        color: #888;
      }
    }
  }
}
.row_line {
  border-bottom: 1px dashed #d7d8dc;
}
.goodsInfo {
  display: flex;
  align-items: center;
}
</style>
